A host device may enable an interaction with a peripheral device, thereby allowing an application of the host device to access additional functions provided by the peripheral device. The host device can be for example a mobile terminal, while the peripheral device can be for example a memory card.
The peripheral device has to be powered up and initialized before it is able to offer its function to a host device. The host device thus has to know when the peripheral device is in a ready state, before it can start to make use of the peripheral device. The time between the start of an initialization and the ready state of a peripheral device is also referred to as timeout.
In one possible approach, the host device polls the peripheral device, until the peripheral device responds that it is in a ready state.
A system in which such a polling is employed is the MultiMediaCard (MMC) system defined in the MultiMediaCard Association (MMCA) standard version 3.3.1.
This standard defines a system which allows a plurality of MultiMediaCards to connect as peripheral devices via an MMC bus to a multimedia application implemented in a host device. Each MultiMediaCard can be a Read Only Memory (ROM) card, a Read/Write (RW) card or an I/O card.
A MultiMediaCard is connected via seven pins to a respective line of the MMC bus. Three pins enable a voltage supply to the card, one pin CMD enables an exchange of commands and responses, one pin DAT enables a data exchange and one pin CLK a supply of a clock signal. The last pin is reserved for future use.
The pins CMD, CLK and DAT are connected within the MultiMediaCard via an interface driver to a card interface controller. The card interface controller has access to a memory core via a memory core interface and in addition to a plurality of registers. The registers include a Card IDentification (CID) register comprising a Card Identification number and an Operation Conditions Register (OCR). The latter is used by a special broadcast command to identify the voltage range supported by the card.
The host device comprises in addition to or combined with the multimedia application an MMC controller, via which the application is connected to the MMC bus. The MMC controller serves as a bus master for the MMC bus.
A host device may reset all connected cards by switching the power supply on the MMC bus off and back on. In addition, an explicit reset signal CMD0 can be used by the host device for resetting a card. When connected cards have been reset in one or the other way, the host device must start an initialization sequence in all cards connected to the MMC bus by a command CMD1. The time which each of the connected MultiMediaCards requires at the most between a command to initialize and a ready state in which a card is ready to receive a new command is specific to the technology of the respective card and might also be dependent on power consumption restrictions.
As the host device cannot be sure when the media has completed the initialization, a polling is used by the host device, in order to check whether a card has entered the ready state. The polling is carried out by transmitting the CMD1 command repeatedly. Each CMD1 command is responded to by the MultiMediaCard with an R3 response, including data on an operating voltage range and in addition a busy bit indicating whether the card has entered a ready state. Both pieces of information are retrieved by the card interface controller of the MultiMediaCard from the OCR.
In case of errors in the functionality of a peripheral device like a MultiMediaCard, however, such a polling results in an infinite loop.
In order to overcome this problem, a fixed time can be selected as the maximum time within which peripheral devices should be required to enter a ready state. The host device will then assume for any type of peripheral device that it has to wait at the most this fixed time before the peripheral device enters the ready state in an error free situation. If the ready state is not entered within the fixed time, the polling is interrupted. In the case of an MMCA system, the fixed time would be the maximum time between the first sent CMD1 command and the time at which a card is ready for receiving the next command.
For the polling frequency, then two alternatives can be considered.
In the first alternative, a rather low polling frequency is employed, for example a polling once each 200 ms in case of an assumed fixed time of one second. Since the ready state might be achieved in the worst case indeed only at the end of the fixed time, this alternative saves computational power at the host device compared to a more frequent polling. It has the disadvantage, though, that if a short response time is required and some peripheral device could even achieve it, valuable time is lost by the low polling frequency.
In the second alternative, a rather high polling frequency is employed despite of the worst case in which a ready state is achieved only at the end of the fixed time. This alternative has the advantage that peripheral devices having a short initialization time can be handled quickly. With peripheral devices having a long initialization time, however, the host device is burdened unnecessarily by the frequent polling.
Further, the fixed time has to be selected to work for all currently known peripheral devices employing certain technologies. Some slower technologies which are currently not yet employed in peripheral devices might have a significantly longer initialization time than allowed by the fixed time. As a consequence, new peripheral devices employing such technologies cannot be used without special arrangements.
In MMC systems, for example, currently MultiMediaCards are employed which all require a maximum of one second for entering the ready state, which makes a fixed time of one second appropriate. These MultiMediaCards include for instance flash memories. It could now be considered to use as well a hard disc in MultiMediaCard format as new type of peripheral device in an MMC system. A hard disc, however, would require a significantly longer initialization time. A hard disc in MultiMediaCard format would thus have to use for instance register data stored into another place than the actual mass memory.
It has to be noted that while problems have been described specifically with reference to an MMC system, similar problems might occur in various other systems in which a host device has to known when a connected peripheral device is ready for operation.